﻿<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<c:set var="path" value="${pageContext.request.contextPath }" />
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!-- 本框架基本脚本和样式 -->
<script type="text/javascript"
	src="${path }/resource/js/plugin/jquery-2.1.4.min.js"></script>
<script type="text/javascript"
	src="${path }/resource/js/systools/MBase.js"></script>
</head>
<body>
<div class="ibox-content">
		<form class="form-horizontal" id="dataform" onsubmit="javascripr:return false;">
			<input type="hidden" name="tokenUrl" value="${tokenUrl}">	 
			<input type="hidden" name="token" value="${token}">
		<c:if test="${obj ne null }">
			<input type="hidden" name="fodId" value="${obj.fodId }">
		</c:if>
		<div class="form-group">
			<label class="col-sm-2 control-label">材料名称
			<span class="text-danger">*</span>
			</label>
			<div class="col-sm-4">
				<input type="text" class="form-control" name="fodName" 
						dataType="*1-20"
					value="<c:out value="${obj.fodName }"></c:out>" nullmsg="材料名称不能为空">
			</div>
			<label class="col-sm-2 control-label">食品类别
			<span class="text-danger">*</span>
			</label>
			<div class="col-sm-4">
				<select class="form-control autoFull select2" dataType="*" nullmsg="食品类别不能为空" 
					data-url="${path}/admin/pcFoodCategory/all"	 
					data-value="fooId"
					data-filed="fooName"
					data-def="${obj.fodTypeId}"  
					name="fodTypeId">
				</select>
			</div>
		</div>	
		<div class="form-group">
			<label class="col-sm-2 control-label">食部(%)
			<span class="text-danger">*</span>
			</label>
			<div class="col-sm-4">
				<input type="number" class="form-control" name="fodPart" 
						min="0" max="100" dataType="s1-5"
					value="<c:out value="${obj.fodPart }"></c:out>" nullmsg="食部不能为空">
			</div>
			<label class="col-sm-2 control-label">食品热量(千卡)
			<span class="text-danger">*</span>
			</label>
			<div class="col-sm-4">
				<input type="number" class="form-control" name="fodEnergy" 
						min="0" dataType="s1-4"
					value="<c:out value="${obj.fodEnergy }"></c:out>" nullmsg="食品热量不能为空">
			</div>
		</div>
		
			<c:forEach items="${elements }" var="ele" varStatus="i">
				<div class="form-group">
				<input type="hidden" name="microFood[${i.index}].micId" value="${ele.micId}">	
					<label class="col-sm-2 control-label">${ele.micName }</label>
					 	<div class="col-sm-4">
							<input type="number" class="form-control" name="microFood[${i.index}].micAmount" 
								dataType="s1-10" min="0"
								value="<c:out value="${ele.micAmount }"/>"  ignore="ignore">
						</div>
					<label class="col-sm-2 control-label">${ele.micUnit }</label>
				</div>
			</c:forEach>
			
		
		<div class="form-group ">
			<div class="col-sm-12 text-center">
				<a href="javascript:;" onclick="myForm.submit()"
					class="btn btn-success radius"><i class="fa fa-check"></i>  保存</a>&nbsp;&nbsp;&nbsp;&nbsp; <a
					 class="btn btn-danger radius" href="javascript:;" onclick="MTools.closeForm()" ><i class="fa fa-close"></i> 关闭</a>
			</div>
		</div>
	</form>
	</div>
</body>
<script type="text/javascript" src="${path }/resource/js/systools/MJsBase.js"></script>
<script type="text/javascript">
	MTools.autoFullSelect();
	$(".select2").select2();
	var myForm=MForm.initForm({
		invokeUrl:"${path}/admin/pcFoodMaterial/addOrModify",
		afterSubmit:function(){
			parent.myGrid.serchData();
		},
	}); 
</script>
</body>
</html>